import http from '../../http'
// 初始化页面 分页和搜索
const initgoods = async (obj) => {
    let data = await http({
        url: 'goods',
        method: 'GET',
        params: obj
    })
    return data
}
// 删除
const deleteitem = async (id) => {
    let data = await http({
        url: `goods/${id}`,
        method: 'delete',
    })
    return data
}
// 添加
const additem = async (obj) => {
    let data = await http({
        url: `goods`,
        method: 'post',
        data: obj
    })
    return data
}
// 搜索数据回填
const getitem = async (id) => {
    let data = await http({
        url: `goods/${id}`,
        method: 'get',
    })
    return data
}
// 确认修改
const updataitem = async (obj) => {
    let data = await http({
        url: `goods/${obj.cat_one_id}`,
        method: 'put',
        data: obj
    })
    return data
}
export {
    initgoods,
    deleteitem,
    getitem,
    additem,
    updataitem
}